<?php
include_once("../modules/checkA.php");
include_once("../../config.php"); 
$plate=select_one_line_all_items($table_Prefix."plate","mid = 'finance'");
?>


<?
//用来判断当前系统属于什么板块
$system_part = $plate['mid'];
include_once("detail-function.php"); 
?>
 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<?php include_once(ROOT_PATH_.'/controlbase/modules/head.php'); ?>
</head>

<body class="finance">

<div id="topbar"><?php include ROOT_PATH_.'/controlbase/modules/topbar.php'; ?></div>

<div id="container" class="<? echo $system_part ?>">

    <div id="maincontent">

        <div id="sidebar">
            <?php include ROOT_PATH_.'/controlbase/modules/sidebar.php'; ?>
        </div>


<div id="content" class="layui-form">
<h1> 财务统计 </h1>




    <div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief">
        <ul class="layui-tab-title">
            <li class="layui-this">汇总</li>

<?$department_list=select_lines_all_items($table_Prefix."department","nid desc","","0");?>
<?for($i=0;$i<count($department_list);$i++){?>
<li ><? echo $department_list[$i]['name'];?></li>
<? ;} ?>

        </ul>
        <div class="layui-tab-content">


<!--tab开始-->
            <div class="layui-tab-item layui-show">
                <div class="layui-form list-box">


                    <h2>近7日统计</h2>
                    <table class="layui-table" >
                        <colgroup>
                            <col >
                            <col >
                            <col >
                            <col >
                            <col>
                        </colgroup>
                        <thead>
                        <tr>
                            <th>日期</th>
                            <th>部门</th>
                            <th>总支出</th>
                            <th>总收入</th>
                            <th>收生费</th>
                            <th>收生</th>
                        </tr>
                        </thead>


                        <tbody>

                        <? for($i=0;$i<7;$i++){?>
                            <tr>
                                <td><?echo date("Y-m-d",strtotime("-$i day"))?></td>
                                <td>合计</td>
                                <td><?echo sum_total($table_Prefix."finance","cost","applydate like '".date("Y-m-d",strtotime("-$i day"))."%' and status = '生效' and cost < 0 ")?></td>
                                <td><?echo sum_total($table_Prefix."finance","cost","applydate like '".date("Y-m-d",strtotime("-$i day"))."%' and status = '生效' and cost > 0 ")?></td>
                                <td><?echo sum_total($table_Prefix."finance","cost","applydate like '".date("Y-m-d",strtotime("-$i day"))."%' and status = '生效' ")?></td>
                                <td><?echo sum_total($table_Prefix."finance","cost","applydate like '".date("Y-m-d",strtotime("-$i day"))."%' and status = '生效' and classify = '学费收款'")?></td>
                            </tr>
                        <?}?>


                        </tbody>


                    </table>





                    <h2>近12个月统计</h2>
                    <table class="layui-table" >
                        <colgroup>
                            <col >
                            <col >
                            <col >
                            <col >
                            <col>
                        </colgroup>
                        <thead>
                        <tr>
                            <th>日期</th>
                            <th>部门</th>
                            <th>总支出</th>
                            <th>总收入</th>
                            <th>收生费</th>
                            <th>收生</th>
                        </tr>
                        </thead>


                        <tbody>
                        <? for($i=0;$i<12;$i++){?>
                            <tr>
                                <td><?echo date("Y-m",strtotime("-$i month"))?></td>
                                <td>合计</td>
                                <td><?echo sum_total($table_Prefix."finance","applydate like '".date("Y-m",strtotime("-$i month"))."%' and status = '生效' and cost < 0 ")?></td>
                                <td><?echo sum_total($table_Prefix."finance","applydate like '".date("Y-m",strtotime("-$i month"))."%' and status = '生效' and cost > 0 ")?></td>
                                <td><?echo sum_total($table_Prefix."finance","applydate like '".date("Y-m",strtotime("-$i month"))."%' and status = '生效' ")?></td>
                                <td><?echo sum_total($table_Prefix."finance","applydate like '".date("Y-m",strtotime("-$i month"))."%' and status = '生效' and classify = '学费收款'")?></td>
                            </tr>
                        <?}?>


                        </tbody>


                    </table>


<!---->
<!---->
<!---->
<!--                    <h2>本月部门招生排名</h2>-->
<!--                    <table class="layui-table" >-->
<!--                        <colgroup>-->
<!--                            <col >-->
<!--                            <col >-->
<!--                            <col >-->
<!--                            <col >-->
<!--                            <col>-->
<!--                        </colgroup>-->
<!--                        <thead>-->
<!--                        <tr>-->
<!--                            <th>日期</th>-->
<!--                            <th>部门</th>-->
<!--                            <th>总支出</th>-->
<!--                            <th>总收入</th>-->
<!--                            <th>收生费</th>-->
<!--                            <th>收生</th>-->
<!--                        </tr>-->
<!--                        </thead>-->
<!---->
<!---->
<!--                        <tbody>-->
<!---->
<!--                        --><?// for($i=0;$i<7;$i++){?>
<!--                            <tr>-->
<!--                                <td>--><?//echo date("Y-m-d",strtotime("-$i day"))?><!--</td>-->
<!--                                <td>合计</td>-->
<!--                                <td>--><?//echo sum_total($table_Prefix."finance","applydate like '".date("Y-m-d",strtotime("-$i day"))."%' and status = '生效' and cost < 0 ")?><!--</td>-->
<!--                                <td>--><?//echo sum_total($table_Prefix."finance","applydate like '".date("Y-m-d",strtotime("-$i day"))."%' and status = '生效' and cost > 0 ")?><!--</td>-->
<!--                                <td>--><?//echo sum_total($table_Prefix."finance","applydate like '".date("Y-m-d",strtotime("-$i day"))."%' and status = '生效' ")?><!--</td>-->
<!--                                <td>--><?//echo sum_total($table_Prefix."finance","applydate like '".date("Y-m-d",strtotime("-$i day"))."%' and status = '生效' and classify = '学费收款'")?><!--</td>-->
<!--                            </tr>-->
<!--                        --><?//}?>
<!---->
<!---->
<!--                        </tbody>-->
<!---->
<!---->
<!--                    </table>-->






                </div>

            </div>
<!--tab结束-->




            <div class="layui-tab-item">内容2</div>
            <div class="layui-tab-item">内容3</div>
            <div class="layui-tab-item">内容4</div>
            <div class="layui-tab-item">内容5</div>
        </div>
    </div>






<!--content端點01-->
</div>
<!--maincontent端點01-->
<br class="clearfloat"/>
</div>
<!--container端點01-->
</div>


<?php include_once('../modules/footer.php'); ?> </body>
</html>
